Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

160
Visualizações
RCRD_DSNT_EXIST","message":" There are no records of this type

Okay everyone, very much through the looking glass on this one. Many thanks to Barmar, Kryton and bknights whose wisdom has helped get me this far.

The script has changed and is now below. I can upload it and generate a script record and it does actually attempt to run, but now I am getting this error:

"type":"error.SuiteScriptError","name":"RCRD_DSNT_EXIST","message":"There are no records of this type.","stack":["createError(N/error)","initiateWorkflow(/SuiteScripts/grn20.js:9)"],"cause":{"type":"internal error","code":"RCRD_DSNT_EXIST","details":"There are no records of this type.","userEvent":"aftersubmit","stackTrace":["createError(N/error)","initiateWorkflow(/SuiteScripts/grn20.js:9)"],"notifyOff":false},"id":"","notifyOff":false,"userFacing":false}

But the record definitely does exist, the ID number and workflow ID are as specified in the workflow.

What else could be causing this problem?

Thank you in advance for any suggestions!

Edit - I have been told that the record ID below should refer to the internal ID of the item, this makes no sense, the workflow I am trying to initiate is designed to change fields on multiple items, why would I need to specify a single item in the script?

/**
 * @NApiVersion 2.x
 * @NScriptType UserEventScript
 */

define(['N/workflow', 'N/search', 'N/error', 'N/record'],
    function (workflow, search, error, record) {
        function initiateWorkflow(scriptContext) {
               var workflowInstanceId = workflow.initiate({
                recordType: 'inventoryitem',
                recordId: 35,
                workflowId: 'customworkflow14'
            });
            var inventoryitemRecord = record.load({
                type: record.Type.INVENTORY_ITEM,
                id: 35
            });
        }
        return {
            afterSubmit: initiateWorkflow
        };
    }); 
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

There are several things wrong with what you are doing. This really is a RTM situation.

You may be just trying to exercise the API so don't really care about the type of script but Netsuite does. It parses the NScriptType annotation and is rejecting your script as being non-conforming.

A user event script has a shape like:


/**
 * @NApiVersion 2.0
 * @NScriptType UserEventScript
 */
define([module list], function(modules...){
    function beforeRecordSubmit(ctx){...} // these functions can use SuiteScript API Modules
    function beforeRecordSubmit(ctx){...}
    function afterRecordSubmit(ctx){...}

// you cannot use Suitescript API Modules outside of the returned functions

return {
    beforeLoad: beforeRecordLoad,
    beforeSubmit: beforeRecordSubmit,
    afterSubmit: afterRecordSumbit
};

});

Also these lines:

workflowTask.recordType = 'INVENTORY_ITEM';
workflowTask.recordId = 'Item';

look like they are just hopeful guesses. There is online help for all of this if you are logged in to Netsuite.

about 4 years ago · Juan Pablo Isaza Relatório

0

There are 2 issues that I can see:

  1. You need to use define() rather than require(). Note from NetSuite documents below:

Note This sample script uses the require function so that you can copy it into the SuiteScript Debugger and test it. You must use the define function in an entry point script (the script you attach to a script record and deploy). For more information, see SuiteScript 2.x Script Basics and SuiteScript 2.x Script Types.

  1. You need to implement an entry point function in your return block. For a User Event Script as this is, that means you need one of beforeLoad, beforeSubmit or afterSubmit.

For your example, your script would end up looking something like this:

/**
 * @NApiVersion 2.0
 * @NScriptType UserEventScript
 */

define(['N/task'],
    function (task) {
        function workflowTask(scriptContext) {
            task.create({
                taskType: task.TaskType.WORKFLOW_TRIGGER
            });
            workflowTask.recordType = 'INVENTORY_ITEM';
            workflowTask.recordId = 'Item';
            workflowTask.workflowId = 'customworkflow14';
            var taskId = workflowTask.submit();
        }
        return {
            afterSubmit: workflowTask
        };
    }
);
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda